package com.gitee.starblues.grape.repository.databases.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gitee.starblues.grape.repository.databases.entity.RebateOrderPo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RebateOrderMapper extends BaseMapper<RebateOrderPo> {
    int deleteByPrimaryKey(Integer id);

    int insert(RebateOrderPo record);

    int insertSelective(RebateOrderPo record);

    RebateOrderPo selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(RebateOrderPo record);

    int updateByPrimaryKey(RebateOrderPo record);
    
    List<RebateOrderPo> selectRebateOrdersByUserId(@Param("userId")String userId);

    int countRebateOrdersByUserId(@Param("userId")String userId);
    
    // 新增根据用户名查询的方法
    List<RebateOrderPo> selectRebateOrdersByUserName(@Param("userName")String userName);

    int countRebateOrdersByUserName(@Param("userName")String userName);
    
    List<RebateOrderPo> selectAllPendingOrders();
    
    RebateOrderPo selectByOrderId(Integer orderId);
    
    // 根据用户名和状态查询的方法
    List<RebateOrderPo> selectRebateOrdersByUserNameAndStatus(@Param("userName")String userName, @Param("status")Integer status);

    int countRebateOrdersByUserNameAndStatus(@Param("userName")String userName, @Param("status")Integer status);
}
